package com.ruoyi.lyy.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.lyy.domain.vo.CarInfoVO;
import com.ruoyi.lyy.service.ICarInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author YueYang
 * Created on 2025/11/17 21:09
 * @version 1.0
 * 车辆信息接口
 */
@RestController
@RequestMapping("/carInfo")
@RequiredArgsConstructor
public class CarInfoController {
    //注入车辆信息服务
    private final ICarInfoService carInfoService;


    /**
     * 根据用户id查询车辆信息
     *
     * @param uid 用户id
     * @return 车辆信息
     */
    @GetMapping("/{userId}")
    public AjaxResult getCarInfoByUserId(@PathVariable("userId") Integer uid) {
        //根据用户id查询车辆信息
        List<CarInfoVO> carInfoVOS = carInfoService.getCarInfoByUserId(uid);
        return AjaxResult.success("车辆信息查询成功", carInfoVOS);
    }
}
